<template>
  <view class="wechat-textarea">
    <view class="wrapper flex-column">
      <textarea
        type="text"
        rows="6"
        v-model="inputValue"
        @input="emitValue"
      ></textarea>
      <button class="button" @click="answer">回复</button>
    </view>
  </view>
</template>

<script setup>
import { ref } from "vue";

const props = defineProps({
  rows: {
    type: Number,
    default: () => 6,
  },
  modelValue: String,
});

const inputValue = ref(props.modelValue);
const emits = defineEmits(["update:modelValue"]);

function emitValue(value) {
  console.log(value);
  emits("update:modelValue", value);
}
</script>

<style scoped lang="scss">
.wechat-textarea {
  .wrapper {
    background-color: #fff;
    position: relative;
    padding-bottom: 64rpx;

    textarea {
      flex: 1;
      text-indent: 10px;
      outline: none;
      border: 1px solid transparent;
      background-color: transparent;
    }

    .button {
      background-color: $main-color;
      color: #fff;
      border: 1px solid #fff;
      outline: none;
      align-self: flex-end;
      position: absolute;
      white-space: nowrap;
      bottom: 16rpx;
      right: 16rpx;
      border-radius: 4px;
    }
  }
}
</style>
